@include("system::admin.layouts._header")
<body>
<div class="layuimini-container">
    <div class="layuimini-main" id="app">
        <form id="app-form" class="layui-form layuimini-form" method="post">
            <div class="layui-tab layui-tab-brief" lay-filter="docDemoTabBrief">
                <ul class="layui-tab-title">
                    @foreach($configs as $key => $cfg)
                        <li @if($key == 0) class="layui-this" @endif>{{$cfg['name']}}</li>
                    @endforeach
                </ul>
                <div class="layui-tab-content">
                    @if(count($lang) > 0)
                        @foreach($configs as $key => $cfg)
                            <div class="layui-tab-item @if($key == 0)  layui-show @endif">
                                @foreach($cfg['elements'] as $ele)

                                    <fieldset>
                                        <legend>{{$ele['label']}}</legend>

                                        @if($ele['type'] == 'input')
                                            <div class="layui-form-item">
                                                <label class="layui-form-label">中文</label>
                                                <div class="layui-input-block">
                                                    <input type="text"  name="{{$cfg['page']}}[cn][{{$ele['ident']}}]"
                                                           class="layui-input"
                                                           value="{{template_config($cfg['page'],$ele['ident'], 'cn')}}">
                                                </div>
                                            </div>
                                        @endif

                                        @if($ele['type'] == 'textarea')
                                            <div class="layui-form-item layui-form-text">
                                                <label class="layui-form-label">中文</label>
                                                <div class="layui-input-block">
                                <textarea name="{{$cfg['page']}}[cn][{{$ele['ident']}}]"
                                          class="layui-textarea">{{template_config($cfg['page'],$ele['ident'], 'cn')}}</textarea>
                                                </div>
                                            </div>
                                        @endif

                                        @if($ele['type'] == 'upload')
                                            <div class="layui-form-item layui-form-text">
                                                <label class="layui-form-label">中文</label>
                                                <div class="layui-input-block layuimini-upload">
                                                    <input name="{{$cfg['page']}}[cn][{{$ele['ident']}}]"
                                                           class="layui-input layui-col-xs6"
                                                           value="{{template_config($cfg['page'],$ele['ident'],'cn')}}">
                                                    <div class="layuimini-upload-btn">
                                    <span><a class="layui-btn" data-upload="{{$cfg['page']}}[cn][{{$ele['ident']}}]"
                                             data-upload-number="one"
                                             data-upload-exts="ico|png|jpg|jpeg"><i
                                                class="fa fa-upload"></i> 上传</a></span>
                                                    </div>
                                                </div>
                                            </div>
                                        @endif

                                        @foreach($lang as $lk => $la)
                                            @if($ele['type'] == 'input')
                                                <div class="layui-form-item">
                                                    <label class="layui-form-label">{{$la}}</label>
                                                    <div class="layui-input-block">
                                                        <input type="text"  name="{{$cfg['page']}}[{{$lk}}][{{$ele['ident']}}]"
                                                               class="layui-input"
                                                               value="{{template_config($cfg['page'],$ele['ident'], $lk)}}">
                                                    </div>
                                                </div>
                                            @endif

                                            @if($ele['type'] == 'textarea')
                                                <div class="layui-form-item layui-form-text">
                                                    <label class="layui-form-label">{{$la}}</label>
                                                    <div class="layui-input-block">
                                <textarea name="{{$cfg['page']}}[{{$lk}}][{{$ele['ident']}}]"
                                          class="layui-textarea">{{template_config($cfg['page'],$ele['ident'], $lk)}}</textarea>
                                                    </div>
                                                </div>
                                            @endif

                                            @if($ele['type'] == 'upload')
                                                <div class="layui-form-item layui-form-text">
                                                    <label class="layui-form-label">{{$la}}</label>
                                                    <div class="layui-input-block layuimini-upload">
                                                        <input name="{{$cfg['page']}}[{{$lk}}][{{$ele['ident']}}]"
                                                               class="layui-input layui-col-xs6"
                                                               value="{{template_config($cfg['page'],$ele['ident'],$lk)}}">
                                                        <div class="layuimini-upload-btn">
                                    <span><a class="layui-btn" data-upload="{{$cfg['page']}}[{{$lk}}][{{$ele['ident']}}]"
                                             data-upload-number="one"
                                             data-upload-exts="ico|png|jpg|jpeg"><i
                                                class="fa fa-upload"></i> 上传</a></span>
                                                        </div>
                                                    </div>
                                                </div>
                                            @endif
                                        @endforeach

                                    </fieldset>

                                @endforeach

                            </div>
                        @endforeach
                    @else
                        @foreach($configs as $key => $cfg)
                            <div class="layui-tab-item @if($key == 0)  layui-show @endif">
                                @foreach($cfg['elements'] as $ele)

                                    @if($ele['type'] == 'input')
                                        <div class="layui-form-item">
                                            <label class="layui-form-label">{{$ele['label']}}</label>
                                            <div class="layui-input-block">
                                                <input type="text" name="{{$cfg['page']}}[{{$ele['ident']}}]"
                                                       class="layui-input"
                                                       placeholder="请输入{{$ele['label']}}"
                                                       value="{{template_config($cfg['page'],$ele['ident'])}}">
                                                <tip>{{$ele['tips'] ?? "填写{$ele['label']}"}}</tip>
                                            </div>
                                        </div>
                                    @endif

                                    @if($ele['type'] == 'textarea')
                                        <div class="layui-form-item layui-form-text">
                                            <label class="layui-form-label">{{$ele['label']}}</label>
                                            <div class="layui-input-block">
                                <textarea name="{{$cfg['page']}}[{{$ele['ident']}}]"
                                          class="layui-textarea">{{template_config($cfg['page'],$ele['ident'])}}</textarea>
                                                {{$ele['tips'] ?? "填写{$ele['label']}"}}
                                            </div>
                                        </div>
                                    @endif

                                    @if($ele['type'] == 'upload')
                                        <div class="layui-form-item layui-form-text">
                                            <label class="layui-form-label">{{$ele['label']}}</label>
                                            <div class="layui-input-block layuimini-upload">
                                                <input name="{{$cfg['page']}}[{{$ele['ident']}}]"
                                                       class="layui-input layui-col-xs6"
                                                       placeholder="请上传{{$ele['label']}}"
                                                       value="{{template_config($cfg['page'],$ele['ident'])}}">
                                                <div class="layuimini-upload-btn">
                                    <span><a class="layui-btn" data-upload="{{$cfg['page']}}[{{$ele['ident']}}]"
                                             data-upload-number="one"
                                             data-upload-exts="ico|png|jpg|jpeg"><i
                                                class="fa fa-upload"></i> 上传</a></span>
                                                </div>
                                            </div>
                                        </div>
                                    @endif
                                @endforeach

                            </div>
                        @endforeach
                    @endif
                </div>
            </div>

            <div class="hr-line"></div>
            <div class="layui-form-item text-center">
                <button type="submit" class="layui-btn layui-btn-normal layui-btn-sm" lay-submit data-refresh="false">
                    确认
                </button>
                <button type="reset" class="layui-btn layui-btn-primary layui-btn-sm">重置</button>
            </div>
        </form>
    </div>
</div>
</body>
</html>
